﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Data.Entity;
using Share.Models;
using System.Data;

namespace admin.Controllers
{
    public class CategoryController : Controller
    {
        //
        // GET: /Category/

        public ActionResult Index()
        {
            return View();
        }

        //
        // GET: /Category/Edit

        public ActionResult Edit(int id)
        {
            return View(DB.Current.Categories.Find(id));
        }

        //
        // POST: /Category/Edit
        [HttpPost]
        public ActionResult Edit(Category c)
        {
            if (ModelState.IsValid)
            {
                DB.Current.Entry(c).State = EntityState.Modified;
                DB.Current.SaveChanges();
                return RedirectToAction("Index");
            }
            return View(c);
        }
    }
}
